package com.httpDemo.config;

import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.httpDemo.doMain.User;

@Configuration // 相当于application-a.xml
public class JavaConfigB {

	@Bean // 相当于<bean id="user2" class="com.httpDemo.doMain.User"/>
	public User user2() {
		return new User(2, "lisi", "广州市汕头区");
	}

	/**
	 * 
	 * @param user Bean注解的方法上的参数会默认从ioc容器上获取
	 * @return
	 */
	@Bean
	public User user4(@Qualifier("user2") User user) {
		user.setName("李四");
		return user;
	}
}
